package com.example.designModel.observe.enhance;

import com.google.common.collect.Lists;

import java.util.List;

public class EventHandler {

    private List<Event> objects;

    public EventHandler() {
        this.objects = Lists.newArrayList();
    }

    public void addEvent(Object object, String methodName, Object...args)
    {
        objects.add(new Event(object, methodName, args));
    }

    public void notifyX() throws Exception
    {
        for (Event event : objects)
        {
            event.invoke();
        }
    }
}
